/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2011
 */

package com.core.basic.secure.dao;

import java.util.*;
import common.base.*;
import common.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.util.page.*;
import cn.org.rapid_framework.page.*;


import com.core.basic.secure.domain.*;
import com.core.basic.secure.dao.*;
import com.core.basic.secure.service.*;
import com.core.basic.secure.query.*;

/**
 * @author badqiu
 * @author hunhun
 * @since 4.0 
 */


import static cn.org.rapid_framework.util.ObjectUtils.*;
import org.springframework.stereotype.Repository;

@SuppressWarnings(value = "all")
@Repository
public class UsersHasRolesDao extends BaseHibernateDao<UsersHasRoles,java.lang.Long>{

	public Class getEntityClass() {
		return UsersHasRoles.class;
	}
	
	public Page<UsersHasRoles> findPage(UsersHasRolesQuery query) {
        
        StringBuilder hqlSb = new StringBuilder("SELECT t FROM  UsersHasRoles t WHERE 1=1 ");
        if(isNotEmpty(query.getUsersId())) {
        	hqlSb.append(" AND  t.usersId = :usersId ");
        }
        if(isNotEmpty(query.getRolesId())) {
        	hqlSb.append(" AND  t.rolesId = :rolesId ");
        }
        if(isNotEmpty(query.getUrId())) {
        	hqlSb.append(" AND  t.urId = :urId ");
        }
        
		return pageQuery(hqlSb.toString(),query);
	}
	

}
